<template>
  <div class="rights">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <el-table style="width: 100%;" :data="RightsList" border>
        <el-table-column type="index" label="#"> </el-table-column>
        <el-table-column label="权限名称" property="authName">
        </el-table-column>
        <el-table-column label="路径" property="path"> </el-table-column>
        <el-table-column label="权限等级" property="level">
          <template #default="{ row }">
            <el-tag v-if="row.level === '0'">一级</el-tag>
            <el-tag type="success" v-else-if="row.level === '1'">二级</el-tag>
            <el-tag type="warning" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'Rightes',
  data() {
    return {
      RightsList: [],
    };
  },
  methods: {
    getRightsList(type) {
      this.__apis.rights.getRights(type).then((res) => {
        if (res.data.meta.status === 200) {
          this.RightsList = res.data.data;
        }
      });
    },
  },
  created() {
    this.getRightsList('list');
  },
};
</script>

<style lang="less" scoped>
.el-breadcrumb {
  font-size: 12px;
}
.el-card {
  margin-top: 15px;
}
</style>
